Quantitative Methodology (UPF)
Paint the fence, first…
…karate later.
Data wrangling
c(value1, value2, value3, ...)tibble(vector1, vector2, ...)General rules for creating objects:
^, !, $, @, +, -, /, *.| Class | Type | Example |
|---|---|---|
| Character | Character | c("b", "c", "d") |
| Factor | Integer | factor(c("b", "c", "d")) |
| Integer | Integer | c(10L, 6L, 12L) |
| Numeric | Double | c(1.1, 3.5, 10.2) |
| Data | Double | as.Date(c("2019/06/04", "2019/11/02", "2020/01/23")) |
| Logical | Logical | c(FALSE, TRUE, FALSE) |
[ ][ , ]CHES Latin America
Codebook available here.
ches_la object. Rows? Columns?Colombia and create a new object named ches_co.General rules for using functions:
function(argument1, argument2 ...)? or other help to know how to use them.Exercise: Afrobarometer - Nigeria
Codebook available here.
File: https://www.jordimas.cat/files/nig.csv
Normally, when they are related to the working environment.
Applied normally to a dataframe:
Applied normally to a vector:
Help!
Using R is impossible without help.
? before a function: e.g. ?sample.| File type | Package | Functions |
|---|---|---|
| csv | readr | read_csv() o read_csv2() |
| xls | readxl | read_xls() |
| xlsx | readxl | read_xlsx() |
| dta | foreign | read.dta() |
| dta | haven | read_dta() |
| sav | haven | read_sav() |
| spss | haven | read_spss() |
readr.Quantitative Methodology (UPF)